<include file="public/layout"/>
<style>
    .te_le .dataTables_paginate{float: left;}
    .bot{float: right;padding: 15px 0}
</style>
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div class="page" style="padding: 0px 1% 0 1%;">
    <!-- 操作说明 -->
    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
                <h3>商品列表</h3>
                <h5>(共{$pager->totalRows}条记录)</h5>
            </div>
            <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
            <form class="navbar-form form-inline" id="search-form2" action="{:U('Promotion/search_goods')}" method="get">
                <div class="sDiv">
                    <div class="sDiv2" style="margin-right: 10px;border:none;">
                        <select name="cat_id" id="cat_id">
                            <option value="">所有分类</option>
                            <foreach name="categoryList" item="v" key="k" >
                                <option value="{$v['id']}" <if condition="$v[id] eq $cat_id">selected</if>>{$v['name']}</option>
                            </foreach>
                        </select>
                    </div>
                    <div class="sDiv2" style="margin-right: 10px;border:none;">
                        <select name="brand_id" id="brand_id">
                            <option value="">所有品牌</option>
                            <foreach name="brandList" item="v" key="k" >
                                <option value="{$v['id']}" <if condition="$v[id] eq $brand_id">selected</if>>{$v['name']}</option>
                            </foreach>
                        </select>
                    </div>
                    <div class="sDiv2" style="margin-right: 10px;border:none;">
                        <select name="intro">
                            <option value="0">全部</option>
                            <option value="is_new">新品</option>
                            <option value="is_recommend">推荐</option>
                        </select>
                    </div>
                    <div class="sDiv2">
                        <select name="status" class="select">
                            <option value="">活动状态</option>
                        </select>
                        <input size="30" name="keywords" value="{$keywords}"class="qsbox" placeholder="商品名称或者关键词" type="text">
                        <input class="btn" value="搜索" type="submit">
                    </div>
                </div>
            </form>
        </div>
        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0">
                    <thead>
                    <tr>
                        <th abbr="article_title" axis="col3" class="" align="left">
                            <div style="text-align: left; width: 50px;" class=""><input type="checkbox" onclick="$('input[name*=\'goods_id\']').prop('checked', this.checked);"></div>
                        </th>
                        <th abbr="article_time" axis="col6" class="" align="left">
                            <div style="text-align: left; width: 600px;" class="">商品名称</div>
                        </th>
                        <th abbr="ac_id" axis="col4" class="" align="left">
                            <div style="text-align: center; width: 80px;" class="">价格</div>
                        </th>
                        <th abbr="article_show" axis="col5" class="" align="center">
                            <div style="text-align: center; width: 80px;" class="">库存</div>
                        </th>
                        <th axis="col1" class=""  align="center">
                            <div style="text-align: center; width: 80px;">操作</div>
                        </th>
                        <th style="width:100%" axis="col7">
                            <div></div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table>
                    <tbody id="goos_table">
                    <volist name="goodsList" id="list">
                        <tr>
                            <td class="" align="left">
                                <div style="text-align: left; width: 50px;">
                                    <input type="checkbox" name="goods_id[]" value="{$list.goods_id}"/>
                                </div>
                            </td>
                            <td class="" align="left">
                                <div style="text-align: left; width: 600px;">{$list.goods_name}</div>
                            </td>
                            <td class="" align="left">
                                <div style="text-align: center; width: 80px;">{$list.shop_price}</div>
                            </td>
                            <td class="" align="left">
                                <div style="text-align: center; width: 80px;">{$list.store_count}</div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 80px; ">
                                    <a class="btn red" onclick="$(this).parent().parent().parent().remove();"><i class="fa fa-trash-o"></i>删除</a>
                                </div>
                            </td>
                            <td class="" style="width: 100%;" align="">
                                <div>&nbsp;</div>
                            </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
            </div>
            <div class="iDiv" style="display: none;"></div>
        </div>
        <!--分页位置-->
        <div class="te_le">
            {$page}
        </div>
        <div class="bot"><a onclick="select_goods();" class="ncap-btn-big ncap-btn-green">确认提交</a></div>
    </div>
</div>
<script>
    function select_goods()
    {
        if($("input[type='checkbox']:checked").length == 0)
        {
            layer.alert('请选择商品', {icon: 2}); //alert('请选择商品');
            return false;
        }
        //将没选中的复选框所在的  tr  remove  然后删除复选框
        $("input[type='checkbox']").each(function(){
            if($(this).is(':checked') == false)
            {
                $(this).parent().parent().parent().remove();
                //$("#goods_list", window.parent.document).append("<tr>"+$(this).html()+'<td><a href="javascript:;" class="icon-close" onclick="goods_del(this)"></a></td></tr>');
            }else{
                $(this).parent().parent().css('display','none');
                $(this).attr("checked","checked");
            }
            //$(this).siblings().show();
        });
//        $(".btn-info").remove();
        javascript:window.parent.call_back($('#goos_table').html());
    }
</script>
</body>
</html>